<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>相册审核</title>
    <link rel="stylesheet" href="${base}/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${base}/css/admin.css">
    <style>
    	.layui-bg-black{        width: 200px;height: 136px;margin-right: 30px;float: left;text-align: center;font-size: 33px;color: #000000!important;padding-top: 30px;}
    	.hide {display: none;}
    	.checkbox{display: inline-block;}
    	.layui-form-item{font-size: 18px;}
    </style>
</head>
<body  class="layui-layout-body" style="overflow:scroll;">
<#include "/common/left.flt">	
<div class="layui-main" style="position: absolute;left: 205px;top: 20px; width: calc(100% - 210px);" >
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  <legend>操作提示</legend>
</fieldset>

<blockquote class="layui-elem-quote layui-quote-nm">
 	<form action="${base}/pic_list/index" method="post" id="dataForm">
         <input type="hidden" id="page" name="page" value="1"/>
         <a onclick="pass();" title="审核通过" class="layui-btn" style="margin-left: 60%;" ><span class="fa fa-check"> 审核通过</span></a> 
         <a onclick="del();" title="删除" class="layui-btn"><span class="fa fa-trash"> 直接删除</span></a>
    </form>
</blockquote> 

<table class="layui-table" >
	<thead>
        <tr>
            <th><input type="checkbox" id="all" />编号</th>
            <th>用户名</th>
            <th>昵称</th>
            <th>状态</th>
            <th>添加时间</th>
            <th>相册图片</th>
            <th>操作</th>
         </tr>
     </thead>
     <tbody>
     <#list page.list as one>
     <tr>
     	<td><input type="checkbox" name="id" value="${one.id}" />${one.id}</td>
     	<td><a href="${base}/users_list/detail?user_id=${one.user_id}" target="_blank" >${one.user_mobile?default('')}</a></td>
     	<td><script>document.write(decodeURIComponent("${one.nick_name?default('')}"));</script></td>
     	<td>${one.status_name?default('')}</td>
     	<td>${one.create_time_string} </td>
     	<td><img width="100" height="100" src="${one.img}" /></td>
     	<td> <a onclick="pass_one(${one.id});" title="审核通过" ><span class="fa fa-check"></span></a> </td>
     </tr>
     </#list>
     </tbody>
</table>
<div id="pageDiv"></div>
<form action="${base}/util/uploadFile" method="post" name="uploadForm" enctype="multipart/form-data" id="uploadForm" class="hide" >
    <input name="pic" type="file" id="pic" class="hide"/>
</form>
</body>
<script src="${base}/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="${base}/layui/layui.all.js"></script>
<script type="text/javascript">
layui.use('laypage',function () {
    var laypage = layui.laypage ;
    laypage.render({
        elem:"pageDiv",
        count:${page.totalPage*15},
        limit:15,
        curr:${page.pageNumber},
        layout:['count','prev','page','next','skip'],
        jump:function (obj,first) {
            var page = obj.curr;
            console.log("page:" + page)
            if(!first){
                $("#page").val(page);
                $("#dataForm").submit();
            }
        }
    });
});

$("#all").click(function (){
	if ($("#all").prop("checked")) {
		$("input[name='id']").prop("checked", true);
	} else {
		$("input[name='id']").prop("checked", false);
	}
});

function pass_one(id){	
	$.post("${base}/pic_list/check_pic",
	   		{"ids":id},function(data){ 
	   			layer.msg(data);
	   			window.location.reload();
	   		}
	    );
}


function pass(){
 	try {
		var ids = "";
		$('input[name="id"]:checked').each(function(){//遍历每一个名字为interest的复选框，其中选中的执行函数    
			ids = ids + $(this).attr("value")+",";
	    });
		if(ids){
			$.post("${base}/pic_list/check_pic",
			   		{"ids":ids},function(data){ 
			   			layer.msg(data);
			   			window.location.reload();
			   		}
			    );
		}
    }catch(e) {
       console.log(e)
    }
	     
}
function del(){
	//询问框
	layer.confirm('确定要删除吗？', {
	  btn: ['确定'] //按钮
	}, function(){
		var ids = "";
		$('input[name="id"]:checked').each(function(){//遍历每一个名字为interest的复选框，其中选中的执行函数    
			ids = ids + $(this).attr("value")+",";
	    });
		if(ids){
			$.post("${base}/pic_list/del",
			   		{"ids":ids},function(data){ 
			   			layer.msg(data);
			   			window.location.reload();
			   		}
			    );
		}		
	});
}

</script>
</html>